<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%-- <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%> --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>员工页面</title>
<script type="text/javascript" src="scripts/jquery-1.7.2.js"></script>
</head>
<body>
<h2>Success</h2>
<!-- <script  type="text/javascript">
	$(document).ready(function(){
		
		$("#deleteEmp").click(function(){
			var empNo = $("#empNo").val();
			$.ajax({
				type:"POST",
				url:"${pageContext.request.contextPath}/deleteEmpById/${emp.empNo}",
				async:true,
				//data:{empNo:$("#empNo").val()},
				//dataType:"json",
				contentType: "application/json;charset=utf-8", //这个是发送信息至服务器时内容编码类型
				success:function(data){
					
				},
				error:function(){
					alert("失败");
				}
			});
			return false;
		});
	});
</script> -->

<c:if test="${empty requestScope.employees}">
	没有一个雇员 
</c:if>

<c:if test="${!empty requestScope.employees}">
<table border="1px" id="empList">
<tr>
	<th>编号</th>
	<th>姓名</th>
	<th>工作</th>
	<th>经理</th>
	<th>入职时间</th>
	<th>薪水</th>
	<th>部门</th>
	<th>操作</th>
</tr>
<c:forEach items="${requestScope.employees}" var="emp">
	<tr>
		<td id = "empNo"><c:out value="${emp.empNo}"></c:out></td>
		<td><c:out value="${emp.ename}"></c:out></td>
		<td><c:out value="${emp.job}"></c:out></td>
		<td><c:out value="${emp.mgr.ename}"></c:out></td>
		<td><c:out value="${emp.hiredate}"></c:out></td>
		<td><c:out value="${emp.sal}"></c:out></td>
		<td><c:out value="${emp.department.dname}"></c:out></td>
		<td><a href = "toDetails/${emp.empNo}">修改</a><a id = "deleteEmp" href = "deleteEmpById/${emp.empNo}">删除</a></td>
	</tr>
</c:forEach>
</table>
<a href = "${pageContext.request.contextPath}/toAddEmp">添加</a>

</c:if>



<%--  empno:<input type = "text" name = "empno" value = "${requestScope.employee.empNo}"/><br>
ename:<input type = "text" name = "ename" value = "${requestScope.employee.ename}"/><br>
job:<input type = "text" name = "job" value = "${requestScope.employee.job}"/><br>
mgr:<input type = "text" name = "mgr" value = "${requestScope.employee.mgr.ename}"/><br>
hiredate:<input type = "text" name = "hiredate" value = "${requestScope.employee.hiredate}"/><br>
sal:<input type = "text" name = "sal" value = "${requestScope.employee.sal}"/><br>
comm:<input type = "text" name = "comm" value = "${requestScope.employee.comm}"/><br>
department.deptNo:<input type = "text" name = "department.deptNo" value = "${requestScope.employee.department.deptNo}"/><br>
department.dname :<input type = "text" name = "department.dname" value = "${requestScope.employee.department.dname}"/><br>
department.loc   :<input type = "text" name = "department.loc" value = "${requestScope.department.loc}"/><br>  --%>

</body>
</html>
